#ifndef WIDGET_H
#define WIDGET_H

#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFileDialog>
#include <QList>
#include <QMessageBox>
#include <QStandardPaths>
#include <QVariant>
#include <QVariantList>
#include <QWidget>

#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonParseError>
#include <QJsonValueRef>

#include "public.h"
#include "xlsxdocument.h"
#include "xlsxproctask.h"
#include "xlsxworkbook.h"
#include "xlsxworksheet.h"
#include <QDateTime>
#include <QFileSystemWatcher>
#include <QProcess>
#include <QThreadPool>

using namespace QXlsx;

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget {
  Q_OBJECT

public:
  Widget(QWidget *parent = nullptr);
  ~Widget();

private slots:
  void defaultInitJson();

  void loadJson();

  void on_selectFileBtn_clicked();

  void on_selectDirBtn_clicked();

  void on_delBox_clicked();

  void on_addBox_clicked();

  void on_procBtn_clicked();

  void initRd();

  void on_filterUserBtn_clicked();

  void on_saveCfgBtn_clicked();

  void on_editCfgBtn_clicked();

  void on_filterUserEdit_textChanged();

  void on_filterUserFiveBtn_clicked();

  void on_sixSplitBtn_clicked();

public slots:
  void procProcss(double, qint64 min, qint64 max); /* 处理进度 */
  void erroInfo(QString);
  void workFinished();
  void exportXlsxFinished();
signals:
  void setWorkParam(const xlsxParam_t &);
  void startThread();
  void importXlsx2Sql(const QString &);
  void exportXlsx();

private:
  Ui::Widget *ui;
  QString configFile;
  QStringList sixFilterList;  /* 六级部门 */
  QStringList fiveFilterList; /* 五级部门 */
  QStringList usrFilterList;  /* 自定义筛选 */

  QString EditTools;
  QProcess procThreExec;
  QFileSystemWatcher *fileWatch;
  xlsxParam_t procParam;
  xlsxProcTask procDoc;
};
#endif // WIDGET_H
